package com.zzh.zzhaiagent.demo.invoke;

import jakarta.annotation.Resource;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.model.ChatModel;
import org.springframework.ai.chat.prompt.Prompt;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * @author: zzh
 * @date: 2025/05/02 22:45:34
 * @version: 1.0
 */
@Component
public class SpringAIAlibabaInvoke implements CommandLineRunner {
    private final ChatClient chatClient;


    public SpringAIAlibabaInvoke(ChatClient.Builder chatClientBuilder) {
        this.chatClient = chatClientBuilder.defaultSystem("你是一个资深的Java工程师").build();
    }


    @Resource
    private ChatModel dashScopeChatModel;

    @Override
    public void run(String... args) throws Exception {
        System.out.println(dashScopeChatModel.call(new Prompt("你好,我是zzh")).getResult().getOutput().getText());
    }
}
